"""
Copyright (c) 2023 - present SKbioinfo
"""

from apps.NGS_API.connect import MysqlConnection
from apps.NGS_API.connector.db_common import *

def query_stock_info(**kwargs):
    query_stock_info = """
    SELECT 
        stc.id,
        sam.project_id,
        stc.stock_id,
        stc.sample_id,
        stc.status,
        stc.stock_label,
        stc.stock_locale,
        stc.instock_type,
        stc.instock_user,
        stc.instock_check_user,
        stc.instock_amount,
        stc.instock_time,
        stc.cur_amount,
        stc.outstock_type,
        stc.outstock_user,
        stc.outstock_check_user,
        stc.outstock_amount,
        stc.status,
        stc.outstock_time,
        stc.create_time,
        stc.modify_time
    FROM {stock} as stc 
    LEFT JOIN {sample} as sam
    ON stc.sample_id = sam.sample_id
    """.format(
        stock=kwargs["stock"],
        sample=kwargs["sample"]
    )
    stock_base_info=query_info(query_sql=query_stock_info)
    return stock_base_info